<?php

require  './vendor/autoload.php';

$client = new MongoDB\Client();
$database = $client->selectDatabase('test');
$col = $database->selectCollection('test2');

$data = array(
    '_id'=>'12312',
    'vcc_id'=>1,
    'nowdate'=>date("Y-m-d"),
    'server_num'=>'58452315',
    'area_code'=>'0713',
    'province'=>'湖北',
    'city'=>'黄冈',
    'path'=>array(1,2)
);

//$res = $col->findOne(array('vcc_id'=>2));
//var_dump($res);
//$col->updateOne(array('_id'=>'12312'), array('$push'=>array('path'=>'ass')));
$col->updateOne(array('_id'=>'12312'), array('$set'=>array('eva_1'=>'test23', 'eva_2'=>'zzz')));
//$type = 'mobile_nums';
//$update = $col->updateOne(
//    $data,
//    array('$inc'=>array($type=>1), '$set'=>array('que_name'=>'test')),
//    array('upsert'=>true)
//);
//var_dump($update->getUpsertedCount());

//$col->insertOne($data);

//printf("Inserted %d document(s)\n", $insertOneResult->getInsertedCount());
//
//var_dump($insertOneResult->getInsertedId());

